#include <stdio.h>
#include <stdlib.h>

#define MAX 8

typedef struct Sqlist {
    int *data;
    int length;
    int MaxSize;
} Sqlist;

Sqlist *initSqlist() 
{ 
    Sqlist *L= (Sqlist *)malloc(sizeof(Sqlist));
    L->data = (int *)malloc(sizeof(int)*MAX);
    L->length = 0;
    L->MaxSize = MAX;
    return L;
}

void Insert(Sqlist *L) 
{
    printf("please enter %d num:\n", L->MaxSize);
    for (int i = 0; i < MAX; i++) {
        scanf("%d", &(L->data[i]));
        L->length++;
    }
}

void printSqlist(Sqlist *L) 
{
    if (L -> length == 0) printf("no elem\n");
    for (int i = 0; i < L->length; i++) {
        printf("%d ", L->data[i]);
    }
    putchar('\n');
}
int main(void)
{
    Sqlist *L = initSqlist(L);
    Insert(L);
    printSqlist(L);

    return 0;
}